import axios from '@/utils/request';

//根据活动id获取优惠券
export function getVoucherById(activityId: number) {
    return axios({
        url: "/activity/voucher/getVoucherById/" + activityId,
        method: "get"
    })
}

//添加优惠券
export function addVoucher(voucher: object) {
    return axios({
        url: "/activity/voucher/addVoucher",
        method: "post",
        data: voucher
    })
}

//修改优惠券
export function updateVoucher(voucher: object) {
    return axios({
        url: "/activity/voucher/updateVoucher",
        method: "put",
        data: voucher
    })
}

//上架或下架优惠券
export function deleteVoucher(id: number, status: number) {
    return axios({
        url: `/activity/voucher/deleteVoucher/${id}/${status}`,
        method: "put"
    })
}

//根据id获取优惠券信息
export function getVoucher(id: number) {
    return axios({
        url: "/activity/voucher/" + id,
        method: "get"
    })
}